package cn.yhz.pethome.base.util;

import lombok.Getter;

@Getter
public class AjaxResult {

    private String message = "操作成功";

    private Boolean state = true;

    public static AjaxResult me() {
        return new AjaxResult();
    }
    private AjaxResult (){

    }
    /**
     * 成功就直接返回这个类
     * @return
     */
    public static AjaxResult success(){
        return me();

    }
    public static AjaxResult error(){
        return me().setMessage("操作失败").setState(false);
    }
    //链式编程
    private AjaxResult setState(Boolean state){
        this.state = state;
        return this;
    }
    private AjaxResult setMessage(String message){
        this.message = message;
        return this;
    }
    public void lhj(){
        System.out.println("这是李红锦的分支代码");
    }
    public void all(){
        System.out.println("这是刘磊的分支代码");
    }

}
